/* ************************************************************************ */
/*                                                                          */
/*  Copyright (c)2005 Russell Weir | damonsbane _at_ gmail                  */
/*                                                                          */
/* This library is free software; you can redistribute it and/or            */
/* modify it under the terms of the GNU Lesser General Public               */
/* License as published by the Free Software Foundation; either             */
/* version 3.0 of the License, or (at your option) any later version.       */
/*                                                                          */
/* This library is distributed in the hope that it will be useful,          */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of           */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        */
/* Lesser General Public License or the LICENSE file for more details.      */
/*                                                                          */
/* ************************************************************************ */

/*
A link line has the form
    Link  LINK-FROM        LINK-TO

For example:
    Link  Europe/Istanbul  Asia/Istanbul

The LINK-FROM field should appear as the NAME field in some
zone line; the LINK-TO field is used as an alternate name
for that zone.
*/

package tzparser;

class LinkLine {
	public static function parse(line : String) : AliasZone
	{
		var r = ~/^(\S+)\s+(\S+)\s+(\S+)[#\s]*/;
		if(!r.match(line))
			return null;
		if(r.matched(1) != "Link") {
			trace("ERROR: NOT LINK LINE: " + line);
			return null;
		}

		return new AliasZone(r.matched(2), r.matched(3));
	}
}